package com.ada.service.impl;

import com.ada.service.HelloService;
import org.apache.dubbo.config.annotation.Service;

import java.util.Random;
@Service
public class ServerImplHello implements HelloService {

    @Override
    public String sayA(String name) {
        Random random = new Random();
        int i = random.nextInt(100);
        try {
            System.out.println("调用A，睡眠"+i);
            Thread.sleep(i);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "Ahello" + name;
    }

    @Override
    public String sayB(String name) {
        Random random = new Random();
        int i = random.nextInt(100);
        try {
            System.out.println("调用B，睡眠"+i);
            Thread.sleep(i);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "Bhello" + name;
    }

    @Override
    public String sayC(String name) {
        Random random = new Random();
        int i = random.nextInt(100);
        try {
            System.out.println("调用C，睡眠"+i);
            Thread.sleep(i);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "Chello" + name;
    }
}
